var ImageGraphic = function(x, y, src)
{
	this.init();
	this.x = x;
	this.y = y;
	this.image = new Image();
	this.imgloaded = false;
	this.image.src = src;
	
	var that = this;
	this.image.onload = function() {
		that.imgloaded = true;
	}
}

// Inherit from graphical object
ImageGraphic.prototype = new GraphicalObject();

ImageGraphic.prototype.init = function()
{
	GraphicalObject.prototype.init.call(this); // Call super method
}

// Sets
ImageGraphic.prototype.setWidth = function(w)
{
	this.width = w;
}

ImageGraphic.prototype.setHeight = function(h)
{
	this.height = h;
}

// Gets
ImageGraphic.prototype.getWidth = function()
{
	return this.width;
}

ImageGraphic.prototype.getHeight = function()
{
	return this.height;
}

// Draw function
ImageGraphic.prototype.draw = function(context)
{
	context.drawImage(this.image, this.x, this.y);
}

ImageGraphic.prototype.getBounds = function()
{
	return {
		x: this.x,
		y: this.y,
		width: this.width,
		height: this.height
	};
}